package com.wavecoler.utilities;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Utilities {

	public static String toMd5(String pass){
        try{
            //Creando Hash MD5
            MessageDigest digest = MessageDigest.getInstance("MD5");
            digest.update(pass.getBytes());
            byte messageDigest[] = digest.digest();
            //Creando Hex String
            StringBuffer hexString = new StringBuffer();
            for(int i=0; i<messageDigest.length; i++)
                hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
            return hexString.toString();
        }catch(NoSuchAlgorithmException ex){
        	return null;
        }
    }
}
